{include file="public/header" /}
<style>
    .earnings-hd {
        height: 2.75rem;
        font-size: 1rem;
        color: var(--c3);
    }
    .earnings-content {
        position: absolute;
        top: 0;
        width: 100%;
        background: #FFF;
    }
    .draw-account {
        display: flex;
        justify-content: space-between;
        text-align: center;
        margin-top: 3.5rem;
    }
    .draw-account-news {
        /* margin: 1.375rem 1rem 0.9375rem 0.8125rem; */
        background-color: var(--cl);
        border-radius: 0.625rem;
        padding: 0 0.9375rem;
        font-size: 0.8125rem;
        margin-top: 1rem;
    }
</style>
<link rel="stylesheet" href="/static/index/css/draw.css">
<body class="hide-top bgc">
<div class="draw-container">
<!--    <img src="/static/index/img/icon36.png" alt="">-->
    <div class="draw-content">
        <div class="earnings-content">
            <div class="earnings-hd flex-center" >
                <i class="layui-icon layui-icon-left flex-center" onclick="history.go(-1)"></i>接点查询
<!--                <div  class="record" onclick="load_href('{:url(\'exchange/record\')}',2)">-->
<!--                    转换记录-->
<!--                </div>-->
            </div>
        </div>
        <div class="draw-account">

        </div>
        <form action="{:url('exchange/save')}" method="post" class="form layui-form">
            <div class="draw-account-news">

                <div class="flex-layout">市场
                    <select name="position" id="position" lay-filter="position" lay-verify="required">
                        <option value="">请选择</option>
                        {foreach name="position" key="key" item="co"}
                        <option value="{$co}">{$co}市场</option>
                        {/foreach}
                    </select>
                </div>

                <div class="flex-layout">会员编号
                    <input type="text" name="code" id="code" class="code" lay-verify="" style="text-align: right">
                </div>
                <div class="flex-layout">会员姓名
                    <input type="text" name="name" id="name" class="name" lay-verify="" style="text-align: right">
                </div>
            </div>
<!--            <p class="save upd-save" lay-submit lay-filter="save" formObj=".form">确认</p>-->
        </form>

    </div>
</div>
</body>

{include file="public/footer"/}
<script>
    layui.use(['form'], function () {
        var form = layui.form;


        form.on('select(position)', function (data) {
            if (data.value) {
                console.log(data.value);
                $.ajax({
                    type: 'GET',
                    url: '{:url("user/query")}',
                    data: {position: data.value},
                    dataType: "json",
                    success: function (data) {
                        if (data.code === 1) {
                            $(".code").val(data.newCode).css('color', '#008200');
                            $(".name").val(data.nickname).css('color', '#008200');
                        } else {
                            $(".code").val("不存在").css('color', 'red');
                        }
                    }
                });
            }
        });
    });

</script>
</html>